<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;
use App\Http\Requests\Admin\Request;

class AdUserAddRequest extends Request
{
    public function rules()
    {
        return [
            'username' => 'required|regex:/[0-9a-z]+/',
            'password' => 'required|same:password|min:6',
            'repassword' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'username.required' => '用户名不能为空',
            'username.regex' => '用户名格式不对',
            'password.required' => '密码不能为空',
            'repassword.required' => '密码不能为空',
            'password.same' => '两次密码不一致',
            'password.min' => '密码最少6位',
        ];
    }
}
